<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/vue-router.js"></script>
    <style>
        ul{
            list-style-type: none;
        }
        ul>li{
            float: left;
            margin-right: 20px;
        }
        ul>li a{
            text-decoration: none;
            color: rgb(250, 8, 8);
        }
        .show{
            clear: both;
            margin-left: 40px;
            border: 1px dotted blue;
            width: 500px;
            height: 400px;
        }
    </style>
</head>
<body>
    <div id="app">
        <ul>
            <li><router-link to="/home">首页大师傅啦埃里克森打击感</router-link></li>
            <li><router-link to="/news">新闻</router-link></li>
            <li><router-link to="/hot">热点</router-link></li>
        </ul>
        <div class="show">
            <router-view></router-view>
        </div>
    </div>
    <template id="hometpl">
        <div>
            <h1>首页内容</h1>
        </div>
    </template>
    <template id="newstpl">
        <div>
            <h1>新闻内容</h1>
        </div>
    </template>
    <template id="hottpl">
        <div>
            <h1>热点内容</h1>
        </div>
    </template>
</body>
</html>
<script>
    var vm=new Vue({
        el:'#app',
        router:new VueRouter({
            routes:[
                {
                    path:'/home',
                    component:{
                        template:'#hometpl'
                    }
                },
                {
                    path:'/news',
                    component:{
                        template:'#newstpl'
                    }
                },
                {
                    path:'/hot',
                    component:{
                        template:'#hottpl'
                    }
                },
            ]
        })
    });
</script>